package com.conversationboard.model;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;

import com.conversationboard.database.Database;
import com.conversationboard.database.Queries;

public class SiteAdmins {

	public static List<String> getSiteAdmins() throws SQLException {

		Connection connection = null;
		List<String> siteAdmins = new LinkedList<String>();

		try {

			connection = Database.getConnection();

			PreparedStatement statement = connection.prepareStatement(Queries.GET_SITE_ADMINS);
			statement.execute();

			ResultSet resultSet = statement.getResultSet();

			while (resultSet.next()) {
				siteAdmins.add(resultSet.getString("loginid"));
			}

			return siteAdmins;

		} finally {
			Database.close(connection);
		}
	}

}
